package com.web.exiaodao.remote.service;

import com.web.exiaodao.business.entity.*;
import com.web.exiaodao.remote.service.impl.ApiFanliOrderServiceImpl;
import com.web.exiaodao.remote.vo.*;
import com.web.webstart.base.exception.BusinessException;
import com.web.webstart.base.service.ApiBaseService;
import com.web.webstart.base.util.result.XaResult;


public interface ApiWalletTradeRecordService extends ApiBaseService<WalletTradeRecordVo, WalletTradeRecord> {
    /**
     * 钱包支付成功
     * 1:用户账户余额fix
     *  2：交易记录添加
     */
    public XaResult<WalletTradeRecordVo> walletPaySucessSaveRecord(UserVo userVo, Order order) throws BusinessException;

    /**
     * 钱包退款成功
     * 1:用户账户余额fix
     * 2：交易记录添加
     */
    public XaResult<WalletTradeRecordVo> walletPayRefundSaveRecord(UserVo userVo, Order order) throws BusinessException;

    /**
     * 钱包充值成功
     * 1:用户账户余额fix
     * 2：交易记录添加
     */
    public XaResult<WalletTradeRecordVo> rechargeSucessSaveRecord(Double price ,User userVo, WalletRechargeRecord order) throws BusinessException;

    /**
     * 钱包提现申请中
     * 1:用户账户余额fix
     * 2：交易记录添加
     * 3: 提现记录增加
     */
    public XaResult<WalletWithdrawRecordVo> widthdrawApplyForring(WalletWithdrawRecord model) throws BusinessException;

    /**
     * 钱包提现失败
     * 1:用户账户余额fix 钱数返还
     * 2：交易记录添加  (1)状态改变 (2):交易完成/关闭时间改变
     * @param walletWithdrawRecordFlowId 钱包提现记录流水号id
     */
    public XaResult<WalletTradeRecordVo> widthdrawFail(String walletWithdrawRecordFlowId, String errorMsg) throws BusinessException;

    /**
     * 钱包提现成功
     * 1：交易记录fix (1)状态改变 (2):交易完成时间改变
     * * @param walletTradeRecordId 钱包提现记录流水号id
     */
    public XaResult<WalletTradeRecordVo> widthdrawSucess(String walletWithdrawRecordFlowId) throws BusinessException;

    /**
     * 每笔订单都完成后的15天都会计算推荐自己注册的这个人获取的收益
     */
    public void autoCalculateEarnings(Order order, ConfigurationTableVo configurationTableVo) throws Exception;

    /**
     * 返利订单完成
     * @see ApiFanliOrderServiceImpl
     */
    public XaResult<FanliOrderVo> fanliOrderSucess(FanliOrder fanliOrder, User user) throws Exception;
}
